<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/resources/css/public.css" media="all" />
    <link rel="stylesheet" href="/resources/layui_ext/dtree/dtree.css">
    <link rel="stylesheet" href="/resources/layui_ext/dtree/font/dtreefont.css">
</head>
<body>
   <ul id="deptTree" class="dtree" data-id="0"></ul>
   <script src="/resources/layui/layui.js"></script>
   <script>
       var deptTree;
       layui.extend({
           dtree: '/resources/layui_ext/dist/dtree'   // {/}的意思即代表采用自有路径，即不跟随 base 路径
       }).use(['layer','jquery','form','dtree'],function() {
               var $ = layui.jquery;
               var layer = layui.layer;
               var form = layui.form;
               var dtree = layui.dtree;

               // 初始化树
           deptTree = dtree.render({
                   elem: "#deptTree",
                   url: "/dept/loadDeptManagerLeftTreeJson" ,// 使用url加载（可与data加载同时存在）
                   method:'get',//这里要改为get才能用
                   dataStyle:"layuiStyle",
                   response:{message:"msg",statusCode:0}, //默认0成功
                   dataFormat:"list"

               });

               // 绑定节点点击
               dtree.on("node('deptTree')" ,function(obj){
//                   layer.msg(JSON.stringify(obj.param));
                   window.parent.right.reloadTable(obj.param.nodeId);
               });
           })
    </script>
</body>
</html>